package entity;

import java.util.regex.*;
public class VisaCC extends CreditCard {
    @Override
    public boolean isValid(String number) {
        super.isValid(number);

        String regex = "5[1-5]\\d{14}";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(number);
        return matcher.matches();
    }

    @Override
    public String getIssuer() {
        return "Visa";
    }

    @Override
    public VisaCC getInstance(){
        return new VisaCC();
    }
}
